home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-10-09 | 3.0 KB | 134 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CTridentwhoView.cp ©1993 Metrowerks Inc. All rights reserved.
- // ===========================================================================
- //
- // A View for demonstrating large Image sizes
- //
- // View draws the vertical Image coordinate at 20 pixel intervals.
- //
- // Clicking, holding, and dragging the mouse outside the View's frame
- // autoscrolls the View
-
- #include "CTridentwhoView.h"
- #include "CTridentApp.h"
- #include "CTridentCmds.h"
- #include "TridentAESuite.h"
- #include <LStream.h>
- //#include <string.h>
-
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- #include <Lists.h>
-
- CTridentwhoView*
- CTridentwhoView::CreateTridentViewStreamA(
- LStream *inStream)
- {
- return (new CTridentwhoView(inStream));
- }
-
- CTridentwhoView::CTridentwhoView(
- LStream *inStream)
- : CTridentView(inStream)
- {
- }
-
- CTridentwhoView::CTridentwhoView()
- {
- }
-
- CTridentwhoView::~CTridentwhoView()
- {
- }
-
-
- void
- CTridentwhoView::HandleAppleEvent(
- const AppleEvent &inAppleEvent,
- AppleEvent &outAEReply,
- AEDesc &outResult,
- long inAENumber)
- {
- OSErr err;
- Str255 theLine;
- // DescType actualCode;
- DescType actualType;
- long actualSize;
- // char* theData[100];
- long count;
- AEKeyword theKey;
- AEDescList theSubList; // each array, ie ConfigList
- // AERecord theRecord; // One object on server.
-
- switch (inAENumber)
- {
- case ae_Close:
- SysBeep(3);
- break;
- case 408:
- case keyMessageCode:
- this->ResetTicks(); //it is alive! (the host that is)
- if (AEGetParamDesc(&inAppleEvent, 'msgs', typeAEList, &theSubList) == noErr)
- {
- err = AECountItems(&theSubList, &count);
-
- ListHandle theList = this->GetMacListH();
- LDelRow(0, 1, theList); //0 means delete all
-
- while (count > 0)
- {
- err = AEGetNthPtr(&theSubList, count, typeChar, &theKey, &actualType, &theLine[1], sizeof(Str255), &actualSize); //counting down!
- if (err != noErr)
- continue;
- // theLine[0] = actualSize-1;
- theLine[0] = actualSize;
- LAddRow(1,0, theList);
- Cell theSelection = {0, 0};
- this->SelectOneCell(theSelection);
- this->SetDescriptor((ConstStr255Param)&theLine);
- ::LSetSelect(FALSE, theSelection, theList);
-
- count--; //remember, last of the list are inserted first so we count down
- }
- }
- AEDisposeDesc(&theSubList);
- break;
- default:
-
- inherited::HandleAppleEvent(inAppleEvent, outAEReply,
- outResult, inAENumber);
- break;
- }
-
- }
- void
- CTridentwhoView::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- outMark = 18;
- switch (inCommand) {
-
- // Return menu item status according to command messages.
- // Any that you don't handle will be passed to LApplication
- case 421:
- case 422:
- case 423:
- case 424:
- case 425:
- outEnabled = FALSE; //memu not used by who ... its sent when it changes
- outMark = 0;
- outUsesMark = FALSE;
- break;
- default:
- inherited::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-